<?php
class indexAction extends Action {
	
	public $isAdmin=false;
	public $login_expire = 3600;
	public function __construct(){
		parent::__construct();
		if(!Csession())echo '<script type="text/javascript">window.top.location="'.__APP__.'";</script>';
		import('@.Class.MCache');
		import('@.Class.Navxml');
		$MCache = new MCache();
		$MCache->GetCache("home/system");
		$this->admin = session(getOnlyName("admin"));
		$this->adname = $this->admin['user']['adname'];
		$this->SS_Aduser = $this->admin['user'];
		if($this->SS_Aduser['id']==1)$this->isAdmin=true;
	}
	
    public function index(){
		if(session(getOnlyName("admin"))){
			$this->display("default:index");
		}else{
			$this->redirect("Login/index");
		}
    }
	
	public function logout(){//退出
		session(getOnlyName("admin"),null);//清空缓存
		$this->redirect("Login/index");
	}
	
	public function top(){//顶部
		$inc = MCache::get('Setting/inc');
		$NavXml = new NavXml();
		$this->nav = $NavXml->checkNav();
		$this->index_url = $inc['index_url'];
		$this->adid = $this->admin['user']['id'];
		$this->display("default:top");
	}
	public function main(){//默认模板
		$this->getBrowser = getBrowser();
		$this->times = date("Y-m-d H:i:s");
		$this->admin = session('username');
		$this->display("default:main");
	}
	public function left(){//左边模板	
		$this->act = empty($_GET['act']) ? "index" : $_GET["act"];
		$NavXml = new NavXml();
		$nav = $NavXml->checkNav();
		$this->nav = $nav[$this->act];
		$this->display("default:left");
	}
	
	public function _empty(){   
	  header("HTTP/1.0 404 Not Found"); 
      $this->display('default:error/404');  
	} 

}